<template>
  <div>
    <el-card>
      <div class="canpany-info">
        <div class="info-left">
          <div>
            公司名称:{{
              jobActiveObj.status == 200
                ? jobActiveObj.enterpriseName
                : "......"
            }}
          </div>
          <div style="margin: 0 15px;">
            注册地址:
            {{
              jobActiveObj.status == 200
                ? jobActiveObj.registerAddress
                : "....."
            }}
          </div>
        </div>
        <div class="out" @click="goOut()">
          <img src="../../../assets/icon/out.png" alt="" />
          退出
        </div>
      </div>
      <el-tabs
        v-model="activeName"
        @tab-click="handleClick"
        v-loading="jobActiveObj.status == 100 ? true : false"
      >
        <el-tab-pane label="纳税金额" name="first">
          <payMoney
            @goOut="goOut"
            :jobActive="jobActive"
            :jobStatus="jobActiveObj.status"
            ref="paymoney"
          ></payMoney>
        </el-tab-pane>
        <el-tab-pane label="开票金额" name="two">
          <reportSearch
            @goOut="goOut"
            :jobActive="jobActive"
            :jobStatus="jobActiveObj.status"
          ></reportSearch>
        </el-tab-pane>
        <el-tab-pane label="纳税信用" name="third">
          <DeclarationInformationVue
            @goOut="goOut"
            :jobActive="jobActive"
            :jobStatus="jobActiveObj.status"
          ></DeclarationInformationVue>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import DeclarationInformationVue from "./DeclarationInformation.vue";
import payMoney from "./payMoney.vue";
import reportSearch from "./reportSearch.vue";
export default {
  props: {
    jobActive: {
      type: String,
      default: "查询任务",
    },
    jobActiveObj: {
      type: Object,
      default: null,
    },
    leftMenu: {
      type: Array,
      default: [],
    },
  },
  components: {
    DeclarationInformationVue,
    payMoney,
    reportSearch,
  },
  watch: {
    //监听左侧菜单
    leftMenu: {
      handler(newVal, oldVal) {
        
        const t1 = newVal[1].child.some((v) => {
          return v.id == this.jobActiveObj.id;
        });
        const t2 = newVal[2].child.some((v) => {
          return v.id == this.jobActiveObj.id;
        });
        const t3 = newVal[0].child.some((v) => {
          return v.id == this.jobActiveObj.id;
        });
        if (t1) {
          this.$emit("editData", {
            id: this.jobActiveObj.id,
            status: 200,
            jobActive: this.jobActive,
          });
        }
        if (t2) {
          this.$emit("editData", {
            id: this.jobActiveObj.id,
            status: 300,
            jobActive: this.jobActive,
          });
        }
        if (t3) {
          this.$emit("editData", {
            id: this.jobActiveObj.id,
            status: 100,
            jobActive: this.jobActive,
          });
        }
      },
      deep: true,
      immediate: true,
    },
  },
  data() {
    return {
      activeName: "first",
    };
  },
  created() {},
  methods: {
    editNmae() {
      this.activeName = "first";
    },
    //   点击tab切换
    handleClick(tab, event) {
      this.jobActive = this.jobActive;
    },
    //  退出触发自定义时间
    goOut(e) {
      this.$emit("goOut", {
        id: this.jobActiveObj.id,
        type: e || 0,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.canpany-info {
  width: 100%;
  height: 50px;
  // line-height: 50px;
  background-color: #f3f9ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-radius: 8px;
  .info-left {
    display: flex;
    width: 80%;
    > div {
      font-size: 12px;
      width: 50%;
    }
  }
  .out {
    display: flex;
    align-items: center;
    color: #409eff;
    cursor: pointer;

    img {
      margin-right: 5px;
      width: 16px;
      height: 16px;
    }
  }
}
</style>